<script type="text/javascript" src="<?php echo base_url()?>themes/back/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>themes/back/js/ckfinder/ckfinder.js"></script>
		
<div class="row">
	<div class="col-xs-12">
		<div class="box box-primary">
		  <div class="box-header">
		    <h3 class="box-title">Edit Data Testimoni</h3>
		  </div><!-- /.box-header -->
      <?=form_open_multipart('content_testimoni/update', array('role' => 'form', 'id' => 'form')); 
				if(!empty($list)){
					?>
		        <div class="box-body">				        
							<input type="hidden" name="id_testimoni" value="<?=$list['id_testimoni']?>" />
							<input type="hidden" name="tmp_foto" value="<?php echo $list['foto']?>" id="tmp_foto" />
							<div class="form-group">
	              <label>Nama</label>
								<input value="<?=$list['nama']?>" class="form-control input-sm" name="nama" type="text" placeholder="Nama">
							</div>
							<div class="form-group">
	              <label>Pekerjaan</label>
								<input value="<?=$list['pekerjaan']?>" class="form-control input-sm" name="pekerjaan" type="text" placeholder="Pekerjaan">
							</div>
							<div class="form-group">
							  <label>Foto</label>
								<div>
								  <?php
								  $path_foto=base_url()."foto_testimoni/".$list['foto'];
								  ?>
									<img src="<?php echo $path_foto?>" height="120" />
								</div>
							</div>
							<div class="form-group">
		            <label>Ganti Foto</label>
								<input type="file" name="foto" id="foto">
								<p class="help-block">Foto yang disarankan ukuran 200 x 200 pixel</p>
						  </div>
		          <div class="form-group">
		            <label >Deskripsi</label>
								<textarea class="form-control" rows="3" id="testimoni" name="testimoni" placeholder="Testimoni"><?=$list['testimoni']?></textarea>	
							</div>
		          <!-- text input -->
		          <?php if (isset($_SERVER['HTTP_REFERER'])) {?>
				        <input type="hidden" name="redirurl" value="<?php echo $_SERVER['HTTP_REFERER'];?>" />
				      <?php }?>
			      </div>		                   
	          <div class="box-footer">
	            <button type="submit" class="btn btn-sm btn-primary btn-flat"><i class="fa fa-floppy-o"></i> Update</button>
	          </div>
	        <?php 
				}else{
					?>
						Tidak ada data
					<?php 
				}
				echo form_close();
			?>
		</div><!-- /.box -->                            
	</div>
</div>

<script>
	var editor=CKEDITOR.replace( 'testimoni',{								
	toolbar :[[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','Image' ],	[ 'Styles','Format','Font','FontSize' ],
				['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
				[ 'UIColor','-','Source' ]]		
		});
	CKFinder.setupCKEditor( editor, '<?php echo base_url()?>themes/back/js/ckfinder/' ) ;
	$("#form").validate({
		rules: {
			nama: {
				required: true
			},
			pekerjaan: {
				required: true
			},
			testimoni: {
				required: true,
				minlength: 10
			}
		}
	});
</script>